
package kdiapo;

import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.JComponent;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;


/* ResizableComponent.java */

public class ResizableComponent extends JFrame {

  /**
	 * 
	 */
	private static final long serialVersionUID = 8254284425082265250L;
private JPanel panel = new JPanel(null);
  private Resizable resizer;


  public ResizableComponent() {

      add(panel);

      JPanel area = new JPanel();
      area.setBackground(Color.white);
      JTextArea txt=new JTextArea();
      txt.setBounds(50, 50, 100, 50);
      area.add(txt);
      resizer = new Resizable(txt);
      resizer.setBounds(50, 50, 100,50);
      panel.add(resizer);


   setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(new Dimension(350, 300));
      setTitle("Resizable Component");
      setLocationRelativeTo(null);
setVisible(true);
      addMouseListener(new MouseAdapter() {
        public void mousePressed(MouseEvent me) {

          requestFocus();
          resizer.repaint();
        }
      });
  }

  public static void main(String[] args) {
      ResizableComponent rc = new ResizableComponent();
      rc.setVisible(true);
  }
}